package com.Rpc远程调用简单版.server;

import com.Rpc远程调用简单版.IHelloService;
import com.Rpc远程调用简单版.impl.HelloServiceImpl;

import java.io.IOException;
import java.net.ServerSocket;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class RpcServer {



    static{

        ServiceRegister.register(IHelloService.class.getSimpleName(),HelloServiceImpl.class);
    }

    public static void main(String[] args) {

         ExecutorService executorService = Executors.newFixedThreadPool(10);

         ServerSocket serverSocket =null;

         try {
              serverSocket   = new ServerSocket(8000);


            while (true) {

                executorService.submit(new RpcInvocationServerHandler(serverSocket.accept()));

            }




        } catch (IOException e) {
            e.printStackTrace();
        }


    }
}
